package com.cn.test1.service;


import com.cn.test1.data.NewsData;
import com.cn.test1.model.NewsModel;

import java.util.ArrayList;
import java.util.List;

public class NewsService {
    public NewsModel getNewsModel() {
        NewsData newsData = new NewsData();
        NewsModel newsModel = new NewsModel();
        newsModel.setNewsDate(newsData.getNewsDate());
        newsModel.setNewsTitles(newsData.getAnnouncement());
        newsModel.setNewsContent4(newsData.getNewsContent4());
        return newsModel;
    }

    public List<NewsModel> getNewsImgs() {
        List<NewsModel> list = new ArrayList<>();
        NewsData newsData = new NewsData();
        for (int i = 0; i < newsData.newsImgs.length; i++) {
            NewsModel newsModel = new NewsModel();
            newsModel.setNewsImgs(newsData.newsImgs[i]);
            newsModel.setNewsTitles(newsData.newsTitles[i]);
            list.add(newsModel);
        }
        return list;
    }

    public List<NewsModel> getNewsContent1() {
        List<NewsModel> list = new ArrayList<>();
        NewsData newsData = new NewsData();
        for (int i = 0; i < newsData.newsContent1.length; i++) {
            NewsModel newsModel = new NewsModel();
            newsModel.setNewsContent1(newsData.newsContent1[i]);
            list.add(newsModel);
        }
        return list;
    }

    public List<NewsModel> getNewsContent2() {
        List<NewsModel> list = new ArrayList<>();
        NewsData newsData = new NewsData();
        for (int i = 0; i < newsData.newsContent2.length; i++) {
            NewsModel newsModel = new NewsModel();
            newsModel.setNewsContent2(newsData.newsContent2[i]);
            newsModel.setNewsContent3(newsData.newsContent3[i]);
            list.add(newsModel);
        }
        return list;
    }

}
